package com.sinozo.data.utils;

/**
 * @author zhaoyb
 * @version 1.0
 * @description
 * @date 2023/5/12 16:29:43
 */
public class PathUtil {

    public static final String CHECK_POINT_PATH = "/checkpoint/";

    public static final String BANK_END_PATH = "/backend/";


    /***
     * @param urlPath
     * @return java.lang.String
     * @date 2023/5/25 14:43:37
     * @author zhaoyb
     * @description 获取checkpoint存储地址
     */
    public static String getHdfsPath(String urlPath, String fileName) {
        StringBuilder hdfsPath = new StringBuilder();
        if (urlPath.endsWith("/")) {
            hdfsPath.append(urlPath).append(fileName).append(CHECK_POINT_PATH);
        } else {
            hdfsPath.append(urlPath).append("/").append(fileName).append(CHECK_POINT_PATH);
        }
        return hdfsPath.toString();
    }

    /***
     * @param urlPath
     * @return java.lang.String
     * @date 2023/5/25 14:43:46
     * @author zhaoyb
     * @description 获取键控状态存储地址
     */
    public static String getBackEndHdfsPath(String urlPath, String fileName) {
        StringBuilder hdfsPath = new StringBuilder();
        if (urlPath.endsWith("/")) {
            hdfsPath.append(urlPath).append(fileName).append(BANK_END_PATH);
        } else {
            hdfsPath.append(urlPath).append("/").append(fileName).append(BANK_END_PATH);
        }
        return hdfsPath.toString();
    }

}
